package cn.wit.front.controller;


import cn.wit.front.condition.ContestCondition;
import cn.wit.front.service.ContestService;
import cn.wit.utils.pojo.Contest;
import cn.wit.utils.response.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/contest")
@Api(tags = "竞赛")
public class ContestController {
    private Logger logger = LoggerFactory.getLogger(ContestController.class);
    @Autowired
    private ContestService contestService;



    //查询不同状态的竞赛信息(全部、即将发布、进行中、往期比赛)
    @GetMapping("/queryContest/{num}/{size}")
    public Result queryContest(@PathVariable("num") int num,
                               @PathVariable("size") int size,
                               ContestCondition condition) {
        IPage<Contest> page = new Page<>(num, size);//构造IPage对象
        return this.contestService.queryContest(page,condition);
    }
}
